import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../controllers/stats_controller.dart';
import 'package:fl_chart/fl_chart.dart';

class StatsPage extends StatelessWidget {
  const StatsPage({super.key});

  @override
  Widget build(BuildContext context) {
    final s = Get.put(StatsController());
    final temps = s.mockTemps();
    return Scaffold(
      appBar: AppBar(title: Text('stats'.tr)),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            Text('Temperature Trend'),
            SizedBox(height: 200, child: LineChart(
              LineChartData(
                lineBarsData: [
                  LineChartBarData(
                    spots: List.generate(temps.length, (i) => FlSpot(i.toDouble(), temps[i])),
                    isCurved: true,
                    barWidth: 2,
                  )
                ]
              )
            )),
          ],
        ),
      ),
    );
  }
}
